package com.example.yls.demoa;

import android.app.IntentService;
import android.content.Intent;
import android.content.Context;
import android.util.Log;

public class MyIntentService extends IntentService {
    private static final String TAG = "MyIntentService";
    public MyIntentService() {
        super("MyIntentService");
    }


    @Override
    protected void onHandleIntent(Intent intent) {
        Log.e(TAG,
                "onHandleIntent:thread ID="+
                        Thread.currentThread().getId());
        int i=0;
        while(i<20){


            Log.e(TAG, "onHandleIntent: I="+i);
            i++;
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

        }

    @Override
    public void onCreate() {
        super.onCreate();
        Log.e(TAG, "onCreate: threadID="+Thread.currentThread().getId());
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.e(TAG, "onDestroy: ");
    }
}



